#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int countVK(const char* s, int n) {
    int count = 0;
    for (int i = 0; i < n - 1; i++) {
        if (s[i] == 'V' && s[i + 1] == 'K') {
            count++;
        }
    }
    return count;
}
int main()
{
    int n;
    char s[101];
    scanf("%d", &n);
    scanf("%s", s);
    int max_count = countVK(s, n);
    for (int i = 0; i < n; i++)
    {
        char original = s[i];
        s[i] = (original == 'V' ? 'K' : 'V');
        int current = countVK(s, n);
        if (current > max_count)
        {
            max_count = current;
        }
        s[i] = original;
    }
    printf("%d\n", max_count);
    return 0;
}